using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace WPFExcelReport
{


    public partial class VICC_WBBEW
    {
        public void SetUpNewRow(ref DataRow dwReturn)
        {

            switch (app.company)
            {
                case "YGR":
                case "TST":
                default:
                    #region=========
                    dwReturn["WBEWMANDANT"] = app.Mandant;
                    dwReturn["WBEWJJJJ"] = "2015";
                    dwReturn["WBEWBELEG"] = "19487";
                    dwReturn["WBEWLFDNR"] = "1";
                    dwReturn["WBEWKUNDNR"] = "00000000";
                    dwReturn["WBEWWERK"] = "   ";
                    dwReturn["WBEWABT"] = "   ";
                    dwReturn["WBEWWAKZ"] = "F";
                    dwReturn["WBEWART"] = "TEST5               ";
                    dwReturn["WBEWVAR"] = "  ";
                    dwReturn["WBEWDESS"] = "          ";
                    dwReturn["WBEWCOLORIT"] = "          ";
                    dwReturn["WBEWFARBE"] = "          ";
                    dwReturn["WBEWBESCHICH"] = "          ";
                    dwReturn["WBEWZUSTAND"] = "    ";
                    dwReturn["WBEWZENSUR"] = "1";
                    dwReturn["WBEWZENSURKZ"] = "A";
                    dwReturn["WBEWTAX"] = "   ";
                    dwReturn["WBEWAUFMSL"] = "  ";
                    dwReturn["WBEWPACKTYP"] = "    ";
                    dwReturn["WBEWLO"] = "01";
                    dwReturn["WBEWLB"] = "BS";
                    dwReturn["WBEWLP"] = "A       ";
                    dwReturn["WBEWAUFBKZ"] = "N";
                    dwReturn["WBEWRWKRS"] = "  ";
                    dwReturn["WBEWRWLFD"] = "000101";
                    dwReturn["WBEWPOS"] = "0001";
                    dwReturn["WBEWSTKNR"] = "101-1       ";
                    dwReturn["WBEWTSTKNR"] = "            ";
                    dwReturn["WBEWGEBNR"] = "        ";
                    dwReturn["WBEWGEBPOS"] = "000";
                    dwReturn["WBEWDPART"] = "           ";
                    dwReturn["WBEWLAGE"] = "0";
                    dwReturn["WBEWBAHN"] = "0";
                    dwReturn["WBEWFSCHL"] = "   ";
                    dwReturn["WBEWPACKNR"] = "0000";
                    dwReturn["WBEWAUFTYP"] = " ";
                    dwReturn["WBEWAUFKRS"] = "  ";
                    dwReturn["WBEWAUFLFD"] = "000000";
                    dwReturn["WBEWAUFPOS"] = "000";
                    dwReturn["WBEWAFOLGE"] = "000";
                    dwReturn["WBEWTP"] = "0000";
                    dwReturn["WBEWAPOS"] = "0000";
                    dwReturn["WBEWWDUPOS"] = "00";
                    dwReturn["WBEWMNRKRS"] = "  ";
                    dwReturn["WBEWMLFDNR"] = "0000";
                    dwReturn["WBEWMPOS"] = "00";
                    dwReturn["WBEWSCHICHT"] = "0";
                    dwReturn["WBEWKSTKRS"] = "  ";
                    dwReturn["WBEWKST"] = "0000";
                    dwReturn["WBEWKOSTART"] = "      ";
                    dwReturn["WBEWBS"] = "10";
                    dwReturn["WBEWWERT"] = "0";
                    dwReturn["WBEWWERTDAT"] = "20150329";
                    dwReturn["WBEWWEKORR"] = "  ";
                    dwReturn["WBEWMTR"] = "1234000";
                    dwReturn["WBEWGEW"] = "0";
                    dwReturn["WBEWBRT"] = "1200";
                    dwReturn["WBEWBUCHDAT"] = "20150329";
                    dwReturn["WBEWBUCHUHR"] = "19591983";
                    dwReturn["WBEWBUCHBEN"] = "INTEXE  ";
                    dwReturn["WBEWFC"] = "WB25    ";
                    dwReturn["WBEWKONDAT"] = "0";
                    dwReturn["WBEWMATABR"] = "J";
                    dwReturn["WBEWSTORKZ"] = " ";
                    dwReturn["WBEWINVBLG"] = "0";
                    dwReturn["WBEWRENRG"] = "           ";
                    dwReturn["WBEWSTGRD"] = "  ";
                    dwReturn["WBEWACTION"] = "  ";
                    dwReturn["WBEWSAPKZ"] = " ";
                    dwReturn["WBEWFILLER"] = "   ";
                    #endregion
                    break;
                case "JLT":
                    #region=========
                    dwReturn["WBEWMANDANT"] = app.Mandant;
                    dwReturn["WBEWJJJJ"] = "2013";
                    dwReturn["WBEWBELEG"] = "0";
                    dwReturn["WBEWLFDNR"] = "1";
                    dwReturn["WBEWKUNDNR"] = "00000000";
                    dwReturn["WBEWWERK"] = "   ";
                    dwReturn["WBEWABT"] = "   ";
                    dwReturn["WBEWWAKZ"] = "F";
                    dwReturn["WBEWART"] = "                    ";
                    dwReturn["WBEWVAR"] = "  ";
                    dwReturn["WBEWDESS"] = "          ";
                    dwReturn["WBEWCOLORIT"] = "          ";
                    dwReturn["WBEWFARBE"] = "          ";
                    dwReturn["WBEWBESCHICH"] = "          ";
                    dwReturn["WBEWZUSTAND"] = "    ";
                    dwReturn["WBEWZENSUR"] = "1";
                    dwReturn["WBEWZENSURKZ"] = "A";
                    dwReturn["WBEWTAX"] = "   ";
                    dwReturn["WBEWAUFMSL"] = "  ";
                    dwReturn["WBEWPACKTYP"] = "    ";
                    dwReturn["WBEWLO"] = "01";
                    dwReturn["WBEWLB"] = "  ";
                    dwReturn["WBEWLP"] = "        ";
                    dwReturn["WBEWAUFBKZ"] = "N";
                    dwReturn["WBEWRWKRS"] = "  ";
                    dwReturn["WBEWRWLFD"] = "000000";
                    dwReturn["WBEWPOS"] = "0000";
                    dwReturn["WBEWSTKNR"] = "            ";
                    dwReturn["WBEWTSTKNR"] = "            ";
                    dwReturn["WBEWGEBNR"] = "        ";
                    dwReturn["WBEWGEBPOS"] = "000";
                    dwReturn["WBEWDPART"] = "           ";
                    dwReturn["WBEWLAGE"] = "0";
                    dwReturn["WBEWBAHN"] = "0";
                    dwReturn["WBEWFSCHL"] = "   ";
                    dwReturn["WBEWPACKNR"] = "0000";
                    dwReturn["WBEWAUFTYP"] = "K";
                    dwReturn["WBEWAUFKRS"] = "  ";
                    dwReturn["WBEWAUFLFD"] = "000000";
                    dwReturn["WBEWAUFPOS"] = "000";
                    dwReturn["WBEWAFOLGE"] = "000";
                    dwReturn["WBEWTP"] = "0000";
                    dwReturn["WBEWAPOS"] = "0000";
                    dwReturn["WBEWWDUPOS"] = "00";
                    dwReturn["WBEWMNRKRS"] = "  ";
                    dwReturn["WBEWMLFDNR"] = "0000";
                    dwReturn["WBEWMPOS"] = "00";
                    dwReturn["WBEWSCHICHT"] = "0";
                    dwReturn["WBEWKSTKRS"] = "  ";
                    dwReturn["WBEWKST"] = "0000";
                    dwReturn["WBEWKOSTART"] = "      ";
                    dwReturn["WBEWBS"] = "62";
                    dwReturn["WBEWWERT"] = "0";
                    dwReturn["WBEWWERTDAT"] = "0";
                    dwReturn["WBEWWEKORR"] = "  ";
                    dwReturn["WBEWMTR"] = "0";
                    dwReturn["WBEWGEW"] = "0";
                    dwReturn["WBEWBRT"] = "0";
                    dwReturn["WBEWBUCHDAT"] = "0";
                    dwReturn["WBEWBUCHUHR"] = "0";
                    dwReturn["WBEWBUCHBEN"] = "        ";
                    dwReturn["WBEWFC"] = "        ";
                    dwReturn["WBEWKONDAT"] = "0";
                    dwReturn["WBEWMATABR"] = "J";
                    dwReturn["WBEWSTORKZ"] = " ";
                    dwReturn["WBEWINVBLG"] = "0";
                    dwReturn["WBEWRENRG"] = "           ";
                    dwReturn["WBEWSTGRD"] = "01";
                    dwReturn["WBEWACTION"] = "  ";
                    dwReturn["WBEWSAPKZ"] = " ";
                    dwReturn["WBEWFILLER"] = "                                                ";
                    #endregion
                    break;
            }
        }
        public void InsertICC_WBBEW(DataRow dwData, int option = 1)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "INSERT INTO ICC_WBBEW   SELECT * FROM WBBEW W"
                        + " WHERE  W.WBEWBELEG>= :WBEWBELEG: AND NOT EXISTS ( SELECT 1 FROM ICC_WBBEW X WHERE X.WBEWBELEG=W.WBEWBELEG  AND X.WBEWLFDNR=W.WBEWLFDNR)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1); 
                    break; 
                case 2:
                    or1.CommandText = "INSERT INTO ICC_WBBEW   SELECT * FROM WBBEW W"
                        + " WHERE W.WBEWBUCHDAT>=:WBEWBUCHDAT: AND  NOT EXISTS ( SELECT 1 FROM ICC_WBBEW X WHERE X.WBEWBELEG=W.WBEWBELEG  AND X.WBEWLFDNR=W.WBEWLFDNR)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1); 
                    break;
            } 
        }
        public void InsertICC_WBBEW(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            or1 = OracleDB.CreateCommand();
            switch (ITXDBVERSION)
            {
                default:
                    or1.CommandText = "INSERT INTO ICC_WBBEW(WBEWMANDANT, WBEWJJJJ, WBEWBELEG, WBEWLFDNR, WBEWKUNDNR, WBEWWERK, WBEWABT, WBEWWAKZ, WBEWART, WBEWVAR, WBEWDESS, WBEWCOLORIT, WBEWFARBE, WBEWBESCHICH, WBEWZUSTAND, WBEWZENSUR, WBEWZENSURKZ, WBEWTAX, WBEWAUFMSL, WBEWPACKTYP, WBEWLO, WBEWLB, WBEWLP, WBEWAUFBKZ, WBEWRWKRS, WBEWRWLFD, WBEWPOS, WBEWSTKNR, WBEWTSTKNR, WBEWGEBNR, WBEWGEBPOS, WBEWDPART, WBEWLAGE, WBEWBAHN, WBEWFSCHL, WBEWPACKNR, WBEWAUFTYP, WBEWAUFKRS, WBEWAUFLFD, WBEWAUFPOS, WBEWAFOLGE, WBEWTP, WBEWAPOS, WBEWWDUPOS, WBEWMNRKRS, WBEWMLFDNR, WBEWMPOS, WBEWSCHICHT, WBEWKSTKRS, WBEWKST, WBEWKOSTART, WBEWBS, WBEWWERT, WBEWWERTDAT, WBEWWEKORR, WBEWMTR, WBEWGEW, WBEWBRT, WBEWBUCHDAT, WBEWBUCHUHR, WBEWBUCHBEN, WBEWFC, WBEWKONDAT, WBEWMATABR, WBEWSTORKZ, WBEWINVBLG, WBEWRENRG, WBEWSTGRD, WBEWACTION, WBEWSAPKZ, WBEWFILLER)"
                                         + "VALUES (:WBEWMANDANT:, 0, :WBEWBELEG:, :WBEWLFDNR:, '00000000', '   ', '   ', ' ', '                    ', '  ', '          ', '          ', '          ', '          ', '    ', '1', 'A', '   ', '  ', '    ', '  ', '  ', '        ', 'J', '  ', '      ', '    ', '            ', '            ', '        ', '000', '           ', 0, 0, '   ', '0000', ' ', '  ', '      ', '   ', '000', '0000', '0000', '00', '  ', '0000', '00', '0', '  ', '0000', '      ', '  ', 0, 0, '  ', 0, 0, 0, 0, 0, '        ', '        ', 0, 'J', ' ', 0, '           ', '  ', '  ', ' ', :WBEWFILLER)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case "SXN":
                case "YGR":
                case "TST":
                    or1.CommandText = "INSERT INTO ICC_WBBEW ( WBEWMANDANT,WBEWJJJJ,WBEWBELEG,WBEWLFDNR,WBEWKUNDNR,WBEWWERK,WBEWABT,WBEWWAKZ,WBEWART,WBEWVAR,WBEWDESS,WBEWCOLORIT,WBEWFARBE,WBEWBESCHICH,WBEWZUSTAND,WBEWZENSUR,WBEWZENSURKZ,WBEWTAX,WBEWAUFMSL,WBEWPACKTYP,WBEWLO,WBEWLB,WBEWLP,WBEWAUFBKZ,WBEWRWKRS,WBEWRWLFD,WBEWPOS,WBEWSTKNR,WBEWTSTKNR,WBEWGEBNR,WBEWGEBPOS,WBEWDPART,WBEWLAGE,WBEWBAHN,WBEWFSCHL,WBEWPACKNR,WBEWAUFTYP,WBEWAUFKRS,WBEWAUFLFD,WBEWAUFPOS,WBEWAFOLGE,WBEWTP,WBEWAPOS,WBEWWDUPOS,WBEWMNRKRS,WBEWMLFDNR,WBEWMPOS,WBEWSCHICHT,WBEWKSTKRS,WBEWKST,WBEWKOSTART,WBEWBS,WBEWWERT,WBEWWERTDAT,WBEWWEKORR,WBEWMTR,WBEWGEW,WBEWBRT,WBEWBUCHDAT,WBEWBUCHUHR,WBEWBUCHBEN,WBEWFC,WBEWKONDAT,WBEWMATABR,WBEWSTORKZ,WBEWINVBLG,WBEWRENRG,WBEWSTGRD,WBEWACTION,WBEWSAPKZ,WBEWFILLER)"
                   + " VALUES ( :WBEWMANDANT:,:WBEWJJJJ:,:WBEWBELEG:,:WBEWLFDNR:,:WBEWKUNDNR:,:WBEWWERK:,:WBEWABT:,:WBEWWAKZ:,:WBEWART:,:WBEWVAR:,:WBEWDESS:,:WBEWCOLORIT:,:WBEWFARBE:,:WBEWBESCHICH:,:WBEWZUSTAND:,:WBEWZENSUR:,:WBEWZENSURKZ:,:WBEWTAX:,:WBEWAUFMSL:,:WBEWPACKTYP:,:WBEWLO:,:WBEWLB:,:WBEWLP:,:WBEWAUFBKZ:,:WBEWRWKRS:,:WBEWRWLFD:,:WBEWPOS:,:WBEWSTKNR:,:WBEWTSTKNR:,:WBEWGEBNR:,:WBEWGEBPOS:,:WBEWDPART:,:WBEWLAGE:,:WBEWBAHN:,:WBEWFSCHL:,:WBEWPACKNR:,:WBEWAUFTYP:,:WBEWAUFKRS:,:WBEWAUFLFD:,:WBEWAUFPOS:,:WBEWAFOLGE:,:WBEWTP:,:WBEWAPOS:,:WBEWWDUPOS:,:WBEWMNRKRS:,:WBEWMLFDNR:,:WBEWMPOS:,:WBEWSCHICHT:,:WBEWKSTKRS:,:WBEWKST:,:WBEWKOSTART:,:WBEWBS:,:WBEWWERT:,:WBEWWERTDAT:,:WBEWWEKORR:,:WBEWMTR:,:WBEWGEW:,:WBEWBRT:,:WBEWBUCHDAT:,:WBEWBUCHUHR:,:WBEWBUCHBEN:,:WBEWFC:,:WBEWKONDAT:,:WBEWMATABR:,:WBEWSTORKZ:,:WBEWINVBLG:,:WBEWRENRG:,:WBEWSTGRD:,:WBEWACTION:,:WBEWSAPKZ:,:WBEWFILLER:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case "JLT":
                    or1.CommandText = "INSERT INTO ICC_WBBEW ( WBEWMANDANT,WBEWJJJJ,WBEWBELEG,WBEWLFDNR,WBEWKUNDNR,WBEWWERK,WBEWABT,WBEWWAKZ,WBEWART,WBEWVAR,WBEWDESS,WBEWCOLORIT,WBEWFARBE,WBEWBESCHICH,WBEWZUSTAND,WBEWZENSUR,WBEWZENSURKZ,WBEWTAX,WBEWAUFMSL,WBEWPACKTYP,WBEWLO,WBEW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R:,:WBEWMPOS:,:WBEWSCHICHT:,:WBEWKSTKRS:,:WBEWKST:,:WBEWKOSTART:,:WBEWBS:,:WBEWWERT:,:WBEWWERTDAT:,:WBEWWEKORR:,:WBEWMTR:,:WBEWGEW:,:WBEWBRT:,:WBEWBUCHDAT:,:WBEWBUCHUHR:,:WBEWBUCHBEN:,:WBEWFC:,:WBEWKONDAT:,:WBEWMATABR:,:WBEWSTORKZ:,:WBEWINVBLG:,:WBEWRENRG:,:WBEWSTGRD:,:WBEWACTION:,:WBEWSAPKZ:,:WBEWFILLER:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }

            Connect2Proxy(or1);
        }

        public void DeleteICC_WBBEW(DataRow dwData, int option = 1)
        {

            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "DELETE FROM ICC_WBBEW   WHERE  WBEWMANDANT=:WBEWMANDANT: AND WBEWAUFTYP=:WBEWAUFTYP:  AND WBEWAUFKRS=:WBEWAUFKRS: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 1:
                    or1.CommandText = "DELETE FROM ICC_WBBEW   WHERE  WBEWMANDANT=:WBEWMANDANT: AND WBEWBELEG=:WBEWBELEG: AND WBEWLFDNR =:WBEWLFDNR:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 2:
                    or1.CommandText = "DELETE FROM ICC_WBBEW   WHERE  WBEWMANDANT=:WBEWMANDANT: AND WBEWRWKRS=:WBEWRWKRS: AND WBEWRWLFD =:WBEWRWLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 3:
                    or1.CommandText = "DELETE FROM ICC_WBBEW WHERE WBEWBELEG<=:WBEWBELEG:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }

        public void DWBBEW04(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE FROM ICC_WBBEW WHERE WBEWMANDANT=:WBEWMANDANT: AND WBEWBUCHDAT>=:WBEWBUCHDAT:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
        public DataSet QueryICC_WBBEW(DataRow dwData, int option)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "SELECT * FROM ICC_WBBEW WHERE WBEWMANDANT=:WBEWMANDANT: AND WBEWBELEG=:WBEWBELEG:  AND WBEWLFDNR=:WBEWLFDNR: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 2:
                    or1.CommandText = "SELECT * FROM ICC_WBBEW WHERE WBEWMANDANT=:WBEWMANDANT: AND WBEWBELEG=:WBEWBELEG: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 3:
                    or1.CommandText = "SELECT P.* FROM ICC_WBBEW P WHERE (WBEWBS='11')"
                    + " AND WBEWMANDANT=:WBEWMANDANT: AND WBEWAUFTYP=:WBEWAUFTYP:  AND WBEWAUFKRS=:WBEWAUFKRS:  AND WBEWAUFLFD=:WBEWAUFLFD: AND WBEWAUFPOS=:WBEWAUFPOS:  ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 4:
                    or1.CommandText = "SELECT P.* FROM ICC_WBBEW P WHERE (WBEWBS='11')"
                    + " AND WBEWMANDANT=:WBEWMANDANT: AND WBEWRWKRS=:WBEWRWKRS:  AND WBEWRWLFD=:WBEWRWLFD: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 5: SResult = QWBBEW05(dwData); break;
                case 6:  SResult = QWBBEW06(dwData); break;
                case 7: SResult = QWBBEW07(dwData);  break;
                default:
                    break;
            }
            
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWBBEW05(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT NVL(MAX(WBEWBELEG),0) AS WBEWBELEG  FROM ICC_WBBEW";
            SResult = Connect2Proxy(or1); 
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWBBEW06(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT NVL(MAX(WBEWBELEG),0) AS WBEWBELEG  FROM ICC_WBBEW WHERE WBEWBUCHDAT<=:GABBUCHDAT:"; ;
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWBBEW07(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT *  FROM ICC_WBBEW WHERE WBEWMANDANT=:WBEWMANDANT: AND WBEWBUCHDAT LIKE '" + dwData["WBEWBUCHDAT"].ToString().Trim() + "%' "
                   + " AND WBEWLO=:WBEWLO:  AND WBEWLB=:WBEWLB:  AND WBEWWAKZ=:WBEWWAKZ:  AND WBEWART=:WBEWART:  AND WBEWVAR=:WBEWVAR:  "
                   + " AND WBEWFARBE=:WBEWFARBE:  AND WBEWBESCHICH=:WBEWBESCHICH:  AND WBEWDESS=:WBEWDESS:"
                       + " AND WBEWCOLORIT=:WBEWCOLORIT: AND WBEWBS=:WBEWBS:   "
                       + " ORDER BY WBEWBELEG,WBEWLFDNR"; 
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public override string BATCHINSERT(DataRow dwData)
        {
            string value = "";
            switch (app.company)
            {
                default:
                case "SXN":
                case "YGR":
                case "TST":
                    value = "INTO ICC_WBBEW  VALUES ( :WBEWMANDANT:,:WBEWJJJJ:,:WBEWBELEG:,:WBEWLFDNR:,:WBEWKUNDNR:,:WBEWWERK:,:WBEWABT:,:WBEWWAKZ:,:WBEWART:,:WBEWVAR:,:WBEWDESS:,:WBEWCOLORIT:,:WBEWFARBE:,:WBEWBESCHICH:,:WBEWZUSTAND:,:WBEWZENSUR:,:WBEWZENSURKZ:,:WBEWTAX:,:WBEWAUFMSL:,:WBEWPACKTYP:,:WBEWLO:,:WBEWLB:,:WBEWLP:,:WBEWAUFBKZ:,:WBEWRWKRS:,:WBEWRWLFD:,:WBEWPOS:,:WBEWSTKNR:,:WBEWTSTKNR:,:WBEWGEBNR:,:WBEWGEBPOS:,:WBEWDPART:,:WBEWLAGE:,:WBEWBAHN:,:WBEWFSCHL:,:WBEWPACKNR:,:WBEWAUFTYP:,:WBEWAUFKRS:,:WBEWAUFLFD:,:WBEWAUFPOS:,:WBEWAFOLGE:,:WBEWTP:,:WBEWAPOS:,:WBEWWDUPOS:,:WBEWMNRKRS:,:WBEWMLFDNR:,:WBEWMPOS:,:WBEWSCHICHT:,:WBEWKSTKRS:,:WBEWKST:,:WBEWKOSTART:,:WBEWBS:,:WBEWWERT:,:WBEWWERTDAT:,:WBEWWEKORR:,:WBEWMTR:,:WBEWGEW:,:WBEWBRT:,:WBEWBUCHDAT:,:WBEWBUCHUHR:,:WBEWBUCHBEN:,:WBEWFC:,:WBEWKONDAT:,:WBEWMATABR:,:WBEWSTORKZ:,:WBEWINVBLG:,:WBEWRENRG:,:WBEWSTGRD:,:WBEWACTION:,:WBEWSAPKZ:,:WBEWFILLER:)";
                    value = INTEXDBC.InjectData(value, dwData);
                    break;
                case "JLT":
                    value = "INTO ICC_WBBEW VALUES (:WBEWMANDANT:,:WBEWJJJJ:,:WBEWBELEG:,:WBEWLFDNR:,:WBEWKUNDNR:,:WBEWWERK:,:WBEWABT:,:WBEWWAKZ:,:WBEWART:,:WBEWVAR:,:WBEWDESS:,:WBEWCOLORIT:,:WBEWFARBE:,:WBEWBESCHICH:,:WBEWZUSTAND:,:WBEWZENSUR:,:WBEWZENSURKZ:,:WBEWTAX:,:WBEWAUFMSL:,:WBEWPACKTYP:,:WBEWLO:,:WBEWLB:,:WBEWLP:,:WBEWAUFBKZ:,:WBEWRWKRS:,:WBEWRWLFD:,:WBEWPOS:,:WBEWSTKNR:,:WBEWTSTKNR:,:WBEWGEBNR:,:WBEWGEBPOS:,:WBEWDPART:,:WBEWLAGE:,:WBEWBAHN:,:WBEWFSCHL:,:WBEWPACKNR:,:WBEWAUFTYP:,:WBEWAUFKRS:,:WBEWAUFLFD:,:WBEWAUFPOS:,:WBEWAFOLGE:,:WBEWTP:,:WBEWAPOS:,:WBEWWDUPOS:,:WBEWMNRKRS:,:WBEWMLFDNR:,:WBEWMPOS:,:WBEWSCHICHT:,:WBEWKSTKRS:,:WBEWKST:,:WBEWKOSTART:,:WBEWBS:,:WBEWWERT:,:WBEWWERTDAT:,:WBEWWEKORR:,:WBEWMTR:,:WBEWGEW:,:WBEWBRT:,:WBEWBUCHDAT:,:WBEWBUCHUHR:,:WBEWBUCHBEN:,:WBEWFC:,:WBEWKONDAT:,:WBEWMATABR:,:WBEWSTORKZ:,:WBEWINVBLG:,:WBEWRENRG:,:WBEWSTGRD:,:WBEWACTION:,:WBEWSAPKZ:,:WBEWFILLER:)";
                    value = INTEXDBC.InjectData(value, dwData);
                    break;
            }
            return value;
        }

        public void UpdateICC_WBBEW(DataRow dwData, string ITXDBVERSION = "50.24", int option = 1)
        {
            if (option == 0)
            {
                switch (app.company)
                {
                    case "YGR":
                    case "YCC":
                    case "JLT":
                    default:
                        option = 1;
                        break;
                }
            }
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    UWBW01(dwData);
                    break;
                case 2:
                    UWBW02(dwData);
                    break;
            }

          
        }
        public void UWBW01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE ICC_WBBEW SET WBEWMANDANT=:WBEWMANDANT:,WBEWJJJJ=:WBEWJJJJ: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WKOSTART=:WBEWKOSTART:,WBEWBS=:WBEWBS:,WBEWWERT=:WBEWWERT:,WBEWWERTDAT=:WBEWWERTDAT:,WBEWWEKORR=:WBEWWEKORR:,WBEWMTR=:WBEWMTR:,WBEWGEW=:WBEWGEW:,WBEWBRT=:WBEWBRT:,WBEWBUCHDAT=:WBEWBUCHDAT:,WBEWBUCHUHR=:WBEWBUCHUHR:,WBEWBUCHBEN=:WBEWBUCHBEN:,WBEWFC=:WBEWFC:,WBEWKONDAT=:WBEWKONDAT:,WBEWMATABR=:WBEWMATABR:,WBEWSTORKZ=:WBEWSTORKZ:,WBEWINVBLG=:WBEWINVBLG:,WBEWRENRG=:WBEWRENRG:,WBEWSTGRD=:WBEWSTGRD:,WBEWACTION=:WBEWACTION:,WBEWSAPKZ=:WBEWSAPKZ:,WBEWFILLER=:WBEWFILLER:"
                + " WHERE WBEWMANDANT=:WBEWMANDANT: AND WBEWBELEG=:WBEWBELEG: AND  WBEWLFDNR=:WBEWLFDNR:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
        public void UWBW02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE ICC_WBBEW SET WBEWBUCHDAT=:WBEWBUCHDAT:"
                     + " WHERE WBEWMANDANT=:WBEWMANDANT: AND WBEWBELEG=:WBEWBELEG: AND  WBEWLFDNR=:WBEWLFDNR:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);

        }
    }
}
